<?php 
 
/**
 * @package	Joomla.Tutorials
 * @subpackage	Module
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license	License GNU General Public License version 2 or later; see LICENSE.txt
 */
 
// No direct access to this file
defined('_JEXEC') or die;
 
class modXosoDientoanHelper
{
	public static function getResult() {
		$db = JFactory::getDBO();
		$result	=	array();
		$date	=	date('Y-m-d');

		$db->setQuery($db->getQuery(true)
				->select("*")
				->from("#__xs_northern")
				->where("date='".$date."' AND type='DT6x36'")
		);
		$row = $db->loadObject();
		if(!$row)
		{
			$db->setQuery($db->getQuery(true)
					->select("*")
					->from("#__xs_northern")
					->where("type='DT6x36'")
					->order('date DESC')
			);
			$row = $db->loadObject();
		}
		$result[]	=	$row;
		
		$db->setQuery($db->getQuery(true)
			->select("*")
			->from("#__xs_northern")
			->where("date='".$date."' AND type='DT123'")
		);
		$row = $db->loadObject();
		if(!$row)
		{
			$db->setQuery($db->getQuery(true)
					->select("*")
					->from("#__xs_northern")
					->where("type='DT123'")
					->order('date DESC')
			);
			$row = $db->loadObject();
		}
		
		$result[]	=	$row;
		
		$db->setQuery($db->getQuery(true)
				->select("*")
				->from("#__xs_northern")
				->where("date='".$date."' AND type='TT'")
		);
		$row = $db->loadObject();
		if(!$row)
		{
			$db->setQuery($db->getQuery(true)
					->select("*")
					->from("#__xs_northern")
					->where("type='TT'")
					->order('date DESC')
			);
			$row = $db->loadObject();
		}
		
		$result[]	=	$row;
		
		return $result;
		
	}
}